package com.roy.workbench.bookmark.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import javax.persistence.*;
import java.util.Collection;

/**
 * Created by admin on 17-12-5.
 */
@Entity
@Table(name = "bm_catalog")
public class Catalog extends BaseEntity {

    @Column(nullable = false)
    private String name;

    private Long pid;

    private String icon;

    @Transient
    private int flag;

    @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    @JoinColumn(name = "pid")
    @JsonIgnoreProperties
    private Collection<Catalog> subCatalog;//下级组织结构

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Collection<Catalog> getSubCatalog() {
        return subCatalog;
    }

    public void setSubCatalog(Collection<Catalog> subCatalog) {
        this.subCatalog = subCatalog;
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public int getFlag() {
        return flag;
    }

    public void setFlag(int flag) {
        this.flag = flag;
    }
}
